<?php
namespace app\api\model;

/**
 * Created by PhpStorm.
 * User: muyu
 * Date: 2018/1/25
 * Time: 20:31
 */
class Product extends   BaseModel{
    protected $hidden = ['delete_time','main_img_id','pivot','update_time','create_time'];
    protected function getMainImgUrlAttr($val,$data){
        return parent::prefix($val,$data);
    }
    public static function getMosttRecent($count){
        $products = self::limit($count)->order('id desc')->select();//限制条数和分页 一样处理
        return $products;
    }
//    分类页面商品
   public static function getProductCateId($id){
         $result =    self::where('category_id','=',$id)->select()    ;
         return $result;
   }
}
